<template>
	<view class="py-2 px-3 bg-danger flex">
		<view class="flex flex-column align-start">
			<view class="flex align-center text-white">
				<text class="font mr-1">￥{{price}}</text>
				<text class="text-through font-sm ">￥{{t_price}}</text>
			</view>
			<view class="bg-white text-danger rounded font-sm py-1 px-2 mt-1">
				<slot></slot>
			</view>
		</view>
		<view class="flex-1 flex align-center justify-end">
			<text class="text-white font-sm mr-1">距结束</text>
			<uni-countdown color="#FFFFFF" splitorColor="#ffffff" background-color="#c3152e" border-color="#fff"
				:day="t.day" :hour="t.hourse" :minute="t.minute" :second="t.second"></uni-countdown>
		</view>
	</view>
</template>

<script>
	import tool from '../../common/tool.js'
	export default {
		name: "active-bar",
		props: {
			// 原价
			t_price: [Number, String],
			price: [Number, String],
			end_time:  String
		},
		created() {
			this.formatTime()
		},
		watch: {
			end_time(newValue, oldValue) {
				this.formatTime()
			}
		},
		data() {
			return {
				t: {
					day: 0,
					hour: 0,
					minute: 0,
					second: 0
				}
			};
		},
		methods: {
			formatTime() {
				this.t = tool.dateCount(this.end_time)
			}
		}
	}
</script>

<style>

</style>
